<template>
	<view class="container">
		
		<view class="codeCard">
			<view class="topImage">
				<image src="https://i.loli.net/2021/04/30/9iUI1XbV2ldFrR3.png" mode=""></image>
			</view>
			<view class="zhezhao">
				
			</view>
			<view style="text-align: center;padding: 40rpx 0;">
				<text v-if="!isInvitation" >分享给好友建立关系</text>
				<text v-if="isInvitation">快接受我的组队邀请吧</text>
			</view>
			<view style="text-align: center;padding: 40rpx 0;">
				<image style="width: 400rpx;height: 400rpx; margin:0 auto;" src="http://mp4.q05.cc/psketch%20%286%29.png" mode=""></image>
			</view>
			<view class="codeBtnList" style="display: flex;justify-content: center;">
			<!-- 	<view class="changeBtn" @click="clickBtn(content)">
					<text>保存二维码</text>
				</view> -->
			<!-- 	<view class="changeBtn" @click="clickBtn(content)">
					<text>复制链接</text>
				</view> -->
			   <button v-if="!isInvitation" class="changeBtn" open-type="share" type="default" style="margin: 0;background-color: #6D39E9;border: none;color: #fff;font-size: 30rpx;font-weight: 500;"  >分享好友</button>
				<button v-if="isInvitation" @click="bindBtn" type="default" style="margin: 0;background-color: #6D39E9;border: none;color: #fff;font-size: 30rpx;font-weight: 500;"  >接受邀请</button>
				<!-- <view class="changeBtn" @click="clickBtn(content)">
					<text>分享给好友</text>
				</view> -->
			</view>
		<!-- 	<view style="margin-top: 80rpx;">
				<u-loadmore :status="status" :load-text="{loadmore: '分享'}" />
			</view>
			<view class="shareIcon">
				<image src="../../static/icon/wx.png" mode=""></image>
			</view> -->
		</view>
	</view>
</template>

<script>
	import {confirmRealation} from '@/model/user.js'
	export default {
		data() {
			return {
				status: 'loadmore',
				relation:'',
				isInvitation:false,
				userId:''
			}
		},
		components:{
		},
		methods: {
			async bindBtn(e){
				const res = await confirmRealation({
					relation:this.relation,
					userId:this.userId
				})
				uni.showToast({
					title:"绑定成功"
				})
				setTimeout(()=>{
					uni.reLaunch({
						url:'/pages/index/index'
					})
				},1000)
				
			},
		},
		onLoad(e){
			const {isInvitation,relation,userId} = e;
			this.relation=relation;
			this.isInvitation=isInvitation;
			this.userId=userId;
		},
		onReady() {},
		onShareAppMessage: function () {
			const userInfo = uni.getStorageSync('userInfo');
			const path = `/pages/relation/invitation?isInvitation=true&relation=${this.relation}&userId=${userInfo.userId}`;
			console.log(path)
		   return {
		     title: '快来和我组队打卡吧',
			 imageUrl:"http://mp4.q05.cc/share.png",
		     path: path
		   }
		 },
	};
</script>

<style lang="scss">
	page{
		background-color: #F8F7FF;
		width: 100%;
		height: 100vh;
		overflow: hidden;
	}
	.shareIcon{
		display: flex;
		justify-content: center;
		
		image{
			width: 120rpx;
			height: 120rpx;
			margin-top: 50rpx;
		}
	}
	.topImage{
		width: 100%;
		display: flex;
		justify-content: center;
		margin-top: 50rpx;
		position: absolute;
		top: -330rpx;
		z-index: -99;
	}
	.zhezhao{
		width: 100%;
		height: 200rpx;
		background-color: #fff;
		position: absolute;
		top: 0;
		z-index: -98;
		border-radius: 50rpx 50rpx 0 0;
	}
	.codeCard{
		width: 100%;
		height: 80vh;
		margin-top: 350rpx;
		position: relative;
		z-index: 2;
		background-color: #fff;
		border-radius: 50rpx 50rpx 0 0;
	}
	.codeBtnList{
		display: flex;
		justify-content: space-between;
		width: 80%;
		margin: 0 auto;
		.custom-style{
			background-color: #6D39E9;
			padding: 12rpx 62rpx;
			color: #fff;
		}
	}
	.changeBtn {
		width: 229rpx;
		height: 75rpx;
		background-color: #6D39E9;
		color: #fff;
		display: flex;
		align-items: center;
		justify-content: center;
		border-radius: 70rpx;
		box-shadow: 0px 2px 8px rgba(109, 57, 233, 0.54);
	}
</style>
